import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/login.vue'
import Main from '../views/Main/Main.vue'
import Home from '../views/Home/Home.vue'
import User from '../views/User/User.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: Login,
    name: 'login'
  },
  { path: '/',
    component: Main,
    children: [
      // path 为"空字符串"的子路由规则，叫做"默认子路由"
      { path: '',
        component: Home,
        name: 'home'
      },
      { path: '/user',
        component: User,
        name: 'user'
      }
    ]
  }
]
const router = new VueRouter({
  routes
})

export default router
